package cn.flying.cloud.system.service;

import javax.annotation.Resource;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import cn.flying.cloud.base.common.vo.layui.XmSelect;
import cn.flying.cloud.system.position.entity.SysPostInfo;
import cn.flying.cloud.system.position.service.SysPostInfoService;

/**
 * <p>
 * 岗位信息表 服务实现类
 * </p>
 *
 * @author admin
 * @since 2024-04-02 13:06:48
 */
@Service
public class SysPositionService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Resource
    private SysPostInfoService sysPostInfoService;

    /**
     * 获取岗位下拉框数据 xm-select
     *
     * @return
     */
    public List<XmSelect> getPositionSelectList() {
        List<SysPostInfo> positions = sysPostInfoService.list();
        List<XmSelect> list = new ArrayList<>();
        XmSelect xmSelect;
        for (SysPostInfo position : positions) {
            xmSelect = new XmSelect();
            xmSelect.setName(position.getPostName());
            xmSelect.setValue(position.getPostId());
            xmSelect.setSelected(false);
            xmSelect.setDisabled(false);

            list.add(xmSelect);
        }
        return list;
    }
}
